package com.huang.redis;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class RedisApplication {

    public static void main(String[] args) {
        SpringApplication.run(RedisApplication.class, args);
    }

    /*将Redisson的客户端注入到容器里面*/
    @Bean
    public Redisson redisson(){
        /*此为单机模式*/
        Config config = new Config();
        config.useSingleServer().setAddress("redis://47.115.219.96:6379").setDatabase(0).setPassword("qq1355518552");

        config.setLockWatchdogTimeout(10000);/*设置分布式锁：watch dog超时时间*/
        return (Redisson) Redisson.create(config);
    }

}
